package com.netease.financial.domain.interactor;

import com.netease.financial.domain.Factory;
import com.netease.financial.domain.executor.PostExecutionThread;
import com.netease.financial.domain.executor.ThreadExecutor;
import com.netease.financial.domain.repository.NfsRepository;

import rx.Observable;

/**
 * Created by hzwuyufeng on 1/20/16.
 */
public class Login extends UseCase {

    private final NfsRepository mNfsRepository;
    private final Factory<String> mClientId;
    private final Factory<String> mClientSecret;
    private final String mAppSecret;

    public Login(Factory<String> clientId, Factory<String> clientSecret, String appSecret, NfsRepository nfsRepository,
                    ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread) {
        super(threadExecutor, postExecutionThread);
        mClientId = clientId;
        mClientSecret = clientSecret;
        mAppSecret = appSecret;
        mNfsRepository = nfsRepository;
    }

    @Override
    protected Observable buildUseCaseObservable() {
        return mNfsRepository.login(mClientId.get(), mClientSecret.get(), mAppSecret);
    }

}
